home *** CD-ROM | disk | FTP | other *** search
- Path: rain.fr!news
- From: Fabien Bergeret <fbergeret@nahua.arcanet.fr>
- Newsgroups: comp.lang.c++
- Subject: Re: Random numbers in C++
- Date: Fri, 26 Jan 96 10:56:07 WET
- Organization: CSI InterNetNews site
- Message-ID: <NEWTNews.822653842.19085.fbergeret@nahua.arcanet.fr>
- References: <4e07ge$me7@server1.ctc.com>
- NNTP-Posting-Host: nahua.arcanet.fr
- Mime-Version: 1.0
- Content-Type: TEXT/PLAIN; charset=US-ASCII
- X-Newsreader: NEWTNews & Chameleon -- TCP/IP for MS Windows from NetManage
-
-
- In Article<4e07ge$me7@server1.ctc.com>, <kemp@ctc.com> write:
- > Path: alpha.rain.fr!rain.fr!news.sprintlink.net!news.localnet.com!ub!news.kei.com!newsfeed.internetmci.com!info.ucla.edu!CTCnet!ctc.com!usenet
- > From: Richard Kemp <kemp@ctc.com>
- > Newsgroups: comp.lang.c++
- > Subject: Random numbers in C++
- > Date: 22 Jan 1996 14:38:06 GMT
- > Organization: Concurrent Technologies Corporation (CTC)
- > Lines: 8
- > Message-ID: <4e07ge$me7@server1.ctc.com>
- > NNTP-Posting-Host: sgi19.ctc.com
- > Mime-Version: 1.0
- > Content-Type: text/plain; charset=us-ascii
- > Content-Transfer-Encoding: 7bit
- > X-Mailer: Mozilla 1.1S (X11; I; IRIX 5.3 IP22)
-
- > How do you make a random number in C++. I'm not familiar with C, so if it's
- a C
- > function that will help a lot also. Thanks!!
-
- #include <stdlib.h>
- #include <time.h>
-
- //Init
- random((unsigned)time(NULL));
-
- //Use
- a = srand()%the_number;
-
-